//
//  PopupController.m
//  News
//
//  Created by xalo on 16/3/10.
//  Copyright © 2016年 News. All rights reserved.
//

#import "PopupController.h"
#import "UMSocial.h"
#import "LoginHelp.h"

@interface PopupController ()

@end

@implementation PopupController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    UIView *myLabel = [[UIView alloc]initWithFrame:CGRectMake(self.view.frame.size.width - 100, 64, 99, 80)];
    myLabel.layer.cornerRadius = 10;
    myLabel.layer.masksToBounds = YES;

    myLabel.backgroundColor = [UIColor darkGrayColor];
        
        UIButton *share = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 100, 39)];
        
        [share setBackgroundColor:[UIColor lightGrayColor]];
        [share setTitle:@"分享" forState:(UIControlStateNormal)];
        
        [share addTarget:self action:@selector(share) forControlEvents:(UIControlEventTouchUpInside)];
        [myLabel addSubview:share];
        
        
        UIButton *collect = [[UIButton alloc]initWithFrame:CGRectMake(0, 41, 100, 39)];
        
        [collect setBackgroundColor:[UIColor lightGrayColor]];
        [collect setTitle:@"收藏" forState:(UIControlStateNormal)];
        
        [collect addTarget:self action:@selector(collection)
          forControlEvents:(UIControlEventTouchUpInside)];
        
        
        [myLabel addSubview:collect];
        [myLabel addSubview:share];
    
        [self.view addSubview:myLabel];

}

//分享按钮
-(void)share {
    
  
   
    [UMSocialSnsService presentSnsIconSheetView:self
                                    appKey:@"56cd552467e58e0b4f001160"
                                      shareText:[NSString stringWithFormat:@"新闻集锦,就选NEWS新闻,把高兴的事情给大家看看 "]
                                     shareImage:[UIImage imageNamed:@"icon.png"]
                                shareToSnsNames:[NSArray arrayWithObjects:  UMShareToRenren,UMShareToTencent,UMShareToQQ,UMShareToWechatTimeline,UMShareToQzone,UMShareToWechatSession,UMShareToFacebook,UMShareToSina,nil]
                                       delegate:nil];
    
    [self removeFromParentViewController];
    [self.view removeFromSuperview];
    
   
}

//收藏按钮
-(void)collection {
    
    
    NSLog(@"收藏");
}

//
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    [self.view removeFromSuperview];
    
    [self removeFromParentViewController];
    
    
    
}


@end
